/* 
 *  com.ctvit.framework.domain.BaseUser.java Create on Apr 21, 2008 5:29:32 PM By Q-Wang 
 * $Header: /home/cvsroot/ctvit/messgeCenter/src/com/ctvit/framework/domain/BasicUser.java,v 1.1 2015/12/18 01:15:49 yushihao Exp $
 */
package com.ctvit.framework.domain;

import java.util.Arrays;
import java.util.Collection;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;



/**
 * 
 * 
 * @author Q-Wang
 *
 */
public class BasicUser extends BaseBean implements UserDetails {
	
	protected GrantedAuthority[] grantedAuthorities;
	
	protected String username;
	
	protected String password;
	
	protected boolean isAccountNonExpired = true;
	
	protected boolean isAccountNonLocked = true;
	
	protected boolean isCredentialsNonExpired = true;
	
	protected boolean isEnabled = true;
	
	protected String lastLoginIp;
	
	protected String lastVisitTime;

	/**
	 * @see org.acegisecurity.userdetails.UserDetails#getAuthorities()
	 */
	public Collection<GrantedAuthority> getAuthorities() {
		return Arrays.asList(grantedAuthorities);
	}

	/**
	 * @see org.acegisecurity.userdetails.UserDetails#getPassword()
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @see org.acegisecurity.userdetails.UserDetails#getUsername()
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @see org.acegisecurity.userdetails.UserDetails#isAccountNonExpired()
	 */
	public boolean isAccountNonExpired() {
		return isAccountNonExpired;
	}

	/**
	 * @see org.acegisecurity.userdetails.UserDetails#isAccountNonLocked()
	 */
	public boolean isAccountNonLocked() {
		return isAccountNonLocked;
	}

	/**
	 * @see org.acegisecurity.userdetails.UserDetails#isCredentialsNonExpired()
	 */
	public boolean isCredentialsNonExpired() {
		return isCredentialsNonExpired;
	}

	/**
	 * @see org.acegisecurity.userdetails.UserDetails#isEnabled()
	 */
	public boolean isEnabled() {
		return isEnabled;
	}

	/**
	 * @return the grantedAuthorities
	 */
	public GrantedAuthority[] getGrantedAuthorities() {
		return grantedAuthorities;
	}

	/**
	 * @param grantedAuthorities the grantedAuthorities to set
	 */
	public void setGrantedAuthorities(GrantedAuthority[] grantedAuthorities) {
		this.grantedAuthorities = grantedAuthorities;
	}

	/**
	 * @return the lastLoginIp
	 */
	public String getLastLoginIp() {
		return lastLoginIp;
	}

	/**
	 * @param lastLoginIp the lastLoginIp to set
	 */
	public void setLastLoginIp(String lastLoginIp) {
		this.lastLoginIp = lastLoginIp;
	}

	/**
	 * @return the lastVisitTime
	 */
	public String getLastVisitTime() {
		return lastVisitTime;
	}

	/**
	 * @param lastVisitTime the lastVisitTime to set
	 */
	public void setLastVisitTime(String lastVisitTime) {
		this.lastVisitTime = lastVisitTime;
	}

	/**
	 * @param username the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @param password the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @param isAccountNonExpired the isAccountNonExpired to set
	 */
	public void setAccountNonExpired(boolean isAccountNonExpired) {
		this.isAccountNonExpired = isAccountNonExpired;
	}

	/**
	 * @param isAccountNonLocked the isAccountNonLocked to set
	 */
	public void setAccountNonLocked(boolean isAccountNonLocked) {
		this.isAccountNonLocked = isAccountNonLocked;
	}

	/**
	 * @param isCredentialsNonExpired the isCredentialsNonExpired to set
	 */
	public void setCredentialsNonExpired(boolean isCredentialsNonExpired) {
		this.isCredentialsNonExpired = isCredentialsNonExpired;
	}

	/**
	 * @param isEnabled the isEnabled to set
	 */
	public void setEnabled(boolean isEnabled) {
		this.isEnabled = isEnabled;
	}
}
